package tolgahan.albayrak.as3.reflection.events
{
	import flash.events.Event;
	
	public class PropertyChangeEvent extends Event
	{
		public static const PROPERTY_CHANGE:String = "propertyChange";
		
		private var _source:Object;
		private var _oldValue:*;
		private var _newValue:*;
		private var _newValueCopy:*;
		private var _name:String;
		
		public function PropertyChangeEvent(source:Object, name:String, oldValue:*, newValue:*)
		{
			_name = name;
			_source = source;
			_oldValue = oldValue;
			_newValue = newValue;
			_newValueCopy = newValue;
			super(PROPERTY_CHANGE, false, true);
		}
		
		public function get name():String
		{
			return _name;
		}
		public function get source():Object
		{
			return _source;
		}
		public function get oldValue():*
		{
			return _oldValue;
		}
		public function get newValue():*
		{
			return _newValue;
		}
		public function set newValue(v:*):void
		{
			_newValue = v;
		}
		public function get isNewValueChanged():Boolean
		{
			return _newValue != _newValueCopy;
		}
	}
}